package com.zyz.E_面向对象.H_内存分析;

/**
 * @author: vick
 * @Date: 2025/3/14
 * @Description:
 * @version: 1.0
 */
public class Person3Test {
    public static void main(String[] args) {
        Person3Test p = new Person3Test();

        Person3 vick = new Person3(001, 20, "vick");
        Person3 tom = new Person3(002, 30, "tom");

        int age = 40;
        p.change01(age); //40
        p.change02(vick);  //003  25  jack
        p.change03(tom);

        //没有发生改变， 为什么！！！
        System.out.println(age);

        //没有发生改变， 为什么！！！
        System.out.println("id:" + vick.id + ",age：" + vick.age + "，name" + vick.name);

        //发生改变
        System.out.println(tom.age);

    }

    public void change01(int i) {
        i = 100;
    }

    public void change02(Person3 p) {
        System.out.println("id:" + p.id + ",age：" + p.age + "，name" + p.name);
        p = new Person3(003, 25, "jack");
    }

    public void change03(Person3 p) {
        p.setAge(25);
    }
}
